package cn.smartorigin.soas.data;

import javax.swing.table.AbstractTableModel;

public class AccountTableModel extends AbstractTableModel {
	
//	private Color selectionColor = new Color();

	
    /**
	 * 
	 */
	private static final long serialVersionUID = 1L;


	/**
	 * Table title
	 */
	private String[] columnNames = {
			"Id",
    		"User Name",
            "User Passwd",
            "Desc"};
    
	private Object[][] data;
	
	public AccountTableModel(Object[][] dataValue){
		data = dataValue;
	}

//    private Object[][] data = {
//            {"Mary", "Campione",
//             "Snowboarding", new Integer(5), new Boolean(false)},
//            {"Alison", "Huml",
//             "Rowing", new Integer(3), new Boolean(true)},
//            {"Kathy", "Walrath",
//             "Knitting", new Integer(2), new Boolean(false)},
//            {"Sharon", "Zakhour",
//             "Speed reading", new Integer(20), new Boolean(true)},
//            {"Philip", "Milne",
//             "Pool", new Integer(10), new Boolean(false)},
//            {"Isaac", "Rabinovitch", 
//                "Nitpicking", new Integer(1000), new Boolean(false)}
//    };
    
	@Override
	public int getRowCount() {
		// TODO Auto-generated method stub
		return data.length;
	}

	@Override
	public int getColumnCount() {
		// TODO Auto-generated method stub
		return columnNames.length;
	}
	
	@Override
    public String getColumnName(int col) {
        return columnNames[col];
    }

	@Override
	public Object getValueAt(int rowIndex, int columnIndex) {
		// TODO Auto-generated method stub
		return data[rowIndex][columnIndex];
	}
	
    /*
     * JTable uses this method to determine the default renderer/
     * editor for each cell.  If we didn't implement this method,
     * then the last column would contain text ("true"/"false"),
     * rather than a check box.
     */
//    public Class getColumnClass(int c) {
//        return getValueAt(0, c).getClass();
//    }

    /*
     * Don't need to implement this method unless your table's
     * editable.
     */
//    public boolean isCellEditable(int row, int col) {
//        //Note that the data/cell address is constant,
//        //no matter where the cell appears onscreen.
//        if (col < 2) {
//            return false;
//        } else {
//            return true;
//        }
//    }

}
